import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import { createPermissionDirective } from '@/utils/permission'

// 导入渠道调试工具（仅在开发环境）
if (process.env.NODE_ENV === 'development') {
  import('@/utils/channelDebug').then(({ channelDebug }) => {
    console.log('渠道调试工具已加载')
  })
}

// 配置axios
axios.defaults.baseURL = process.env.VUE_APP_BASE_API || '/api'

// 挂载到Vue实例上，方便使用
Vue.prototype.$http = axios

Vue.use(ElementUI)

// 注册权限指令
createPermissionDirective(Vue)

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
